package com.blockmeta.bbs.businesslibrary.net.callback;

import android.content.Context;

import com.blockmeta.bbs.baselibrary.net.callback.MyStringCallback;

import okhttp3.Call;
import okhttp3.Response;

/**
 * Created by KKK on 2017/10/26.
 */

public abstract class ApiStringCallBack extends MyStringCallback {
    private Context context;
    public int code;

    public ApiStringCallBack(Context context) {
        this.context = context;
    }

    @Override
    public boolean validateReponse(Response response, int id) {
        code = response.code();
        return super.validateReponse(response, id) || code <= 500;
    }

    @Override
    public void onError(Call call, Exception e, int id) {
//        ToastUtil.show(context, "联网失败,请检查网络");

    }


    public abstract void onResponse(String response, int id);
}
